package com.startit.validation;

import com.startit.csv.CSVField.ValidationType;
import com.startit.util.StringUtil;

public class MatchValidation implements IValidation {
	public static final ValidationType name = ValidationType.MATCH;

	private String regex;

	public MatchValidation(String regex) {
		super();
		this.regex = regex;
	}

	public boolean valid(String v) {
		return StringUtil.isEmpty(v) || v.matches(regex);
	}

}
